package com.winit.cloudlink.rabbitmq.mgmt;

import com.google.common.collect.Lists;
import org.junit.After;

import java.util.ArrayList;

/**
 * @author Richard Clayton (Berico Technologies)
 */
public class ITBase {

    public static final String HOSTNAME = "172.16.2.176";
    public static final String PORT = "15672";
    public static final String USERNAME = "admin";
    public static final String PASSWORD = "admin123";

    ArrayList<String> queuesToDelete = Lists.newArrayList();

    @After
    public void cleanup() {

        RabbitMgmtService mgmt = getManagementService();

        for (String queue : queuesToDelete) {

            mgmt.queues().delete(queue);
        }
    }

    public RabbitMgmtService getManagementService() {

        String hostname = HOSTNAME;
        int port = Integer.parseInt(PORT);
        String username = USERNAME;
        String password = PASSWORD;

        return RabbitMgmtService.builder().credentials(username, password).host(hostname).port(port).build();
    }

}
